package com.esri.core.map.bing;

import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import com.esri.core.map.bing.Result;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class Response<V extends Result> {
    private String a;
    private URL b;
    private String c;
    private int d;
    private String e;
    private String f;
    private List<V> g;
    private Class<V> h;
    private int i = -1;

    public Response(Class<V> cls) {
        this.h = cls;
    }

    public String getAuthenticationResultCode() {
        return this.a;
    }

    public URL getBrandLogoUri() {
        return this.b;
    }

    public String getCopyright() {
        return this.c;
    }

    public int getStatusCode() {
        return this.d;
    }

    public String getStatusDescription() {
        return this.e;
    }

    public String getTraceId() {
        return this.f;
    }

    public List<V> getResults() {
        return this.g;
    }

    public int getOutSR() {
        return this.i;
    }

    public void setOutSR(int i) {
        this.i = i;
    }

    public void fromJson(JsonParser jsonParser) throws Exception {
        if (!d.c(jsonParser)) {
            throw new EsriServiceException("This response cannot be parsed.");
        }
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("authenticationResultCode".equals(currentName)) {
                this.a = jsonParser.getText();
            } else if ("brandLogoUri".equals(currentName)) {
                this.b = new URL(jsonParser.getText());
            } else if ("copyright".equals(currentName)) {
                this.c = jsonParser.getText();
            } else if ("statusCode".equals(currentName)) {
                this.d = jsonParser.getIntValue();
            } else if ("statusDescription".equals(currentName)) {
                this.e = jsonParser.getText();
            } else if ("traceId".equals(currentName)) {
                this.f = jsonParser.getText();
            } else if ("resourceSets".equals(currentName)) {
                this.g = new ArrayList();
                while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                    while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                        String currentName2 = jsonParser.getCurrentName();
                        jsonParser.nextToken();
                        if ("resources".equals(currentName2)) {
                            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                                V newInstance = this.h.newInstance();
                                newInstance.fromJson(jsonParser, this.i);
                                this.g.add(newInstance);
                            }
                        } else {
                            jsonParser.skipChildren();
                        }
                    }
                }
            } else {
                jsonParser.skipChildren();
            }
        }
    }
}
